package com.cos.controller;

import com.cos.entity.User;
import com.cos.service.impl.UserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserServiceImpl userService;

    @RequestMapping("/add")
    public boolean add(@RequestBody User user){
        return userService.save(user);
    }

    @RequestMapping("/getList")
    public List<User> getList(){
        return userService.list();
    }
}
